package com.siyougame.system.dal.mysql.social;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.siyougame.system.dal.dataobject.social.SocialUserBindDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface SocialUserBindMapper extends BaseMapper<SocialUserBindDO> {

    default void deleteByUserTypeAndSocialUserId(@Param("userType")Integer userType, @Param("socialUserId")Long socialUserId) {
        delete(new LambdaQueryWrapper<SocialUserBindDO>()
                .eq(SocialUserBindDO::getUserType, userType)
                .eq(SocialUserBindDO::getSocialUserId, socialUserId));
    }

    default void deleteByUserTypeAndUserIdAndSocialType(@Param("userType")Integer userType,  @Param("userId")Long userId,  @Param("socialType")String socialType) {
        delete(new LambdaQueryWrapper<SocialUserBindDO>()
                .eq(SocialUserBindDO::getUserType, userType)
                .eq(SocialUserBindDO::getUserId, userId)
                .eq(SocialUserBindDO::getSocialType, socialType));
    }
}
